<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        /*
        块元素水平居中: 给自己设置margin: auto;
        行内和行内块元素水平居中: 给父元素设置text-align: center;
         */
        .one {
            width: 200px;
            height: 200px;
            background: pink;
            text-align: center; /*让子元素居中*/
            margin: auto; /*让自身居中*/
        }

        .two {
            width: 50px;
            height: 50px;
            background: #0c89de;
            margin: auto;
        }
    </style>
</head>
<body>
<div class="app">
    <div class="one">
        <span>一个文本</span>
        <div class="two"></div>
    </div>
</div>
</body>
</html>